Những câu hỏi liên quan
Selena Flynn
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 3 2022 lúc 23:03

c1: 

#include <bits/stdc++.h>

using namespace std;

long long i,n,s;

int main()

{

cin>>n;

s=1;

for (i=1; i<=n; i++) s=s*i;

cout<<s;

return 0;

}

Câu 2: 

#include <bits/stdc++.h>

using namespace std;

long long i,n,s;

int main()

{

cin>>n;

s=1;

for (i=1; i<=n; i++) if (i%2==0) s=s*i;

cout<<s;

return 0;

}

Bình luận (0)
Phan Thị Ka
Xem chi tiết
Minh Lệ
19 tháng 3 2023 lúc 22:40

Câu 1:

Program HOC24;

var i,p: integer;

t: longint;

begin

write('Nhap P: '); readln(p);

t:=0;

for i:=1 to p do if i mod 2<>0 then t:=t+i;

write('Tong cac so le la: ',t);

readln

end.

Bình luận (0)
Minh Lệ
19 tháng 3 2023 lúc 22:41

Câu 2:

Program HOC24;

var i,n: integer;

t: longint;

begin

write('Nhap N: '); readln(n);

t:=0;

for i:=1 to n do if i mod 2=0 then t:=t+i;

write('Tong cac so chan la: ',t);

readln

end.

Bình luận (0)
Minh Lệ
19 tháng 3 2023 lúc 22:42

Câu 3:

Program HOC24;

var i,t,n: integer;

begin

write('Nhap N: '); readln(n);

t:=0;

for i:=1 to n do if n mod i=0 then t:=t+i;

write('Tong cac uoc cua ',n,' la: ',t);

readln

end.

Bình luận (0)
Hưng Quốc
Xem chi tiết
Thanh Phong (9A5)
31 tháng 3 2023 lúc 16:51

1. Uses crt;

var n,i: integer;

begin clrscr;

readln(n);

for i:=1 to n do write(i:3);

readln;

end.

2. Uses crt;

var n,i: integer;

begin clrscr;

readln(n);

for i:=1 to n do if(i mod 2 = 0) then write(i:3);

readln;

end.

Bình luận (0)
láobốlaos
31 tháng 3 2023 lúc 16:54

1. Uses crt;

var n,i: integer;

begin clrscr;

readln(n);

for i:=1 to n do write(i:3);

readln;

end.

2. Uses crt;

var n,i: integer;

begin clrscr;

readln(n);

for i:=1 to n do if(i mod 2 = 0) then write(i:3);

readln;

end.

Bình luận (0)
Nguyễn Hoàng Duy
2 tháng 4 2023 lúc 16:31

1.

program InDaySoTuNhien;
var n, i: integer;
begin
   write('Nhap so nguyen duong n: ');
   readln(n);

   writeln('Day so tu 1 den ', n, ' la:');
   for i := 1 to n do
      write(i, ' ');
end.

2.

program InSoChan;
var
   n, i: integer;
begin
   write('Nhap so nguyen n: ');
   readln(n);

   writeln('Cac so nguyen chan trong khoang tu 1 den ', n, ' la:');
   for i := 1 to n do
   begin
      if i mod 2 = 0 then
         write(i, ' ');
   end;
end.

Bình luận (0)
Đặng Tiến Đức
Xem chi tiết
Lee Hà
9 tháng 12 2021 lúc 10:16

program Chanle;

uses crt;

var x: integer;

begin

clrscr;

readln(x)

if (x mod 2 = 0) then write('day la so chan') else write('day la so le');

readln

end.

Bình luận (0)
minh tiến dương
Xem chi tiết
tho hit co
Xem chi tiết
Nguyễn Phạm Như Quỳnh
Xem chi tiết
thik
Xem chi tiết
Phía sau một cô gái
3 tháng 4 2023 lúc 22:02

program Chan_Le;

var

     n, i: integer;

begin

     write('Nhap vao so nguyen N: ');

     readln(n);

     writeln('Cac so chan tu 1 den ', n, ' la:');

     for i := 2 to n do

     begin

          if i mod 2 = 0 then

          begin

               write(i, ' ');

          end;

     end;

     writeln;

     writeln('Cac so le tu 1 den ', n, ' la:');

     for i := 1 to n do

     begin

          if i mod 2 <> 0 then

          begin

               write(i, ' ');

          end;

     end;

     readln;

end.

Bình luận (0)
Nguyễn Hoàng Duy
4 tháng 4 2023 lúc 0:06

program Chan_Le;

var n, i: integer;

begin
  write('Nhap vao so nguyen n: ');
  readln(n);
  writeln('Cac so chan tu 1 den ',n, ' la: ');
  for i := 1 to n do
  begin
    if i mod 2 = 0 then
      write(i, ' ');
  end;
  writeln;
  writeln('Cac so le tu 1 den ', n, ' la: ');
  for i := 1 to n do
  begin
    if i mod 2 <> 0 then
      write(i, ' ');
  end;
  readln;
  end.

Bình luận (0)
Lê Thế
Xem chi tiết
Lê Thế
7 tháng 9 2021 lúc 19:35

Giúp tôi vơi tôi cần gấp

 

Bình luận (0)
Nguyễn Hoài Đức CTVVIP
7 tháng 9 2021 lúc 19:36

uses crt;

var n, i, j, dem: longint; {Bạn có thể thay longint thành integer nha}

A:array[1..1000] of longint;

begin

clrscr;

Write('Nhap N: '); readln(n);

for i:=1 to n do

begin

write('Nhap phan tu thu ',i,': ');

readln(A[i]);

end;

Write('Cac so nguyen to co trong mang la: ');

for i:=1 to n do

begin

dem:=0;

for j:=2 to A[i]/2 do

if A[i] mod j=0 then dem:=dem+1;

if dem=0 then write(A[i],' ');

end;

end.

Bình luận (2)
Nguyễn Hoài Đức CTVVIP
7 tháng 9 2021 lúc 19:36

Tk

uses crt;

var n, i, j, dem: longint; {Bạn có thể thay longint thành integer nha}

A:array[1..1000] of longint;

begin

clrscr;

Write('Nhap N: '); readln(n);

for i:=1 to n do

begin

write('Nhap phan tu thu ',i,': ');

readln(A[i]);

end;

Write('Cac so nguyen to co trong mang la: ');

for i:=1 to n do

begin

dem:=0;

for j:=2 to A[i]/2 do

if A[i] mod j=0 then dem:=dem+1;

if dem=0 then write(A[i],' ');

end;

end.

Bình luận (0)